<template>
    <view style="height: 100%">
        <!-- components/group-share-pop/index.wxml -->
        <!-- <van-popup :show="show" position="bottom" custom-class="popup-container" @close="closePop"> -->
            <u-popup :show="show" position="bottom" custom-class="popup-container" @close="closePop">
                <view class="container">
                    <button class="item" open-type="share" @tap="share">
                        <image src="http://oos-cn.ctyunapi.cn/front-end/static/marketingImg/marketing/images/icon-wx.png" class="icon"></image>
                        <text class="text">分享至微信</text>
                    </button>
                    <!-- <button class="item" bindtap="copy">
                <image src="http://oos-cn.ctyunapi.cn/front-end/static/marketingImg/marketing/images/icon-link.png" class="icon"></image>
                <text class="text">复制连接</text>
            </button> -->
                </view>
            </u-popup>
        <!-- </van-popup> -->
    </view>
</template>

<script lang="ts">
// import zpMixins from '@/uni_modules/zp-mixins/index';
// import vanPopup from './@vant/weapp/popup/index';

import shareTypes from '../../../utils/shareTypes';

// components/group-share-pop/index.ts
export default {
    components: {
        // vanPopup
    },
    data() {
        return {
            show: false
        };
    },
    /**
     * 组件的属性列表
     */
    props: {
        activityId: {
            // type: Number,
            required: true
        },
        groupId: {
            // type: Number,
            required: true
        }
    },
    /**
     * 组件的方法列表
     */
    methods: {
        showPop() {
            this.setData({
                show: true
            });
        },
        closePop() {
            this.setData({
                show: false
            });
        },
        share() {
            let pathA = `marketing/pages/sharePage/sharePage?groupId=${this.groupId}&activityId=${this.activityId}&ST=${shareTypes.PINGTUAN}`
            console.log(pathA,'pataaaa')

            uni.share({
                provider: 'weixin',
                scene: "WXSceneSession",
                type: 5,
                imageUrl: 'http://oos-cn.ctyunapi.cn/front-end/static/marketingImg/marketing/images/invitation/activity.png',
                title: '参团邀请',
                miniProgram: {
                    id: 'gh_e7ee791d29a1',
                    path: pathA,
                    type: 2,
                    webUrl: 'https://yimjisdm/app/'
                },
                success: ret => {
                    console.log(JSON.stringify(ret),'ssss');
                },
                fail: function (err) {
                    console.log("fail:" + JSON.stringify(err));
                }
            });


            // plus.share.getServices(function(res) {
            //     let sweixin = null;
            //     for (let i in res) {
            //         if (res[i].id == 'weixin') {
            //             sweixin = res[i];
            //         }
            //     }
            //     if (sweixin) {sweixin.launchMiniProgram({
            //         id: 'gh_e7ee791d29a1', //微信小程序的ID
            //         type: 2,
            //         path: pathA,
            //     });
            // }}, 
            // function(e) {
            //     console.log('获取分享服务列表失败：' + e.message);
            // });

        },
        copy() {
            // const { activityId, groupId }: any = this;
            // console.log(activityId, groupId);
            // wx.setClipboardData({})
        }
    },
    created: function () {}
};
</script>
<style lang="less" scoped>
/* components/group-share-pop/index.wxss */
.popup-container {
    width: 702rpx !important;
    height: 221rpx;
    margin: 0 24rpx 26rpx 24rpx;
    background: linear-gradient(0deg, #ffffff, #f4f6f8);
    border: 2rpx solid #ffffff;
    box-shadow: 4rpx 7rpx 20rpx 0rpx rgba(166, 171, 179, 0.24);
    border-radius: 16rpx;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 221rpx;

    .item {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background: transparent;
        margin: 0;
        padding: 0;

        &::after {
            border: none;
        }

        .icon {
            width: 106rpx;
            height: 106rpx;
        }
        .text {
            font-size: 24rpx;
            font-family: PingFang SC;
            font-weight: 500;
            color: #606266;
            margin-top: 10rpx;
        }
    }
}
</style>
